/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.Arrays;

/**
 * <p>Project: jse2303 - Arr3
 * <p>Powered by webrx On 2023-07-12 10:48:20
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Arr3 {
    public static void main(String[] args) {
        //声明一个数组,10个元素int
        int[] ns = new int[10];
        //System.out.println(ns[10]);
        //System.out.println(ns[ns.length]);
        System.out.println(ns[0]);

        //快速输出数组
        System.out.println(ns);
        System.out.println(ns.length);
        System.out.println(Arrays.toString(ns));

        ns[0] = 10;
        ns[5] = 50;
        System.out.println(Arrays.toString(ns));

        //遍历数组
        for (int i = 0; i < ns.length; i++) {
            System.out.printf("ns[%d]=%d%n", i, ns[i]);
        }
        System.out.println();
        for (int i = ns.length - 1; i >= 0; i--) {
            System.out.printf("ns[%d]=%d%n", i, ns[i]);
        }
        for (var t : ns) {
            System.out.println(t);
        }
    }
}
